<?php
$plugin->load_plugin_lang();

$nb_categories = retrieve(POST,'nb_categories', '');
$nb_entities = retrieve(POST,'nb_entities', '');

if(($nb_categories!='') && ($nb_entities!=''))
{
	$Sql->query_inject("INSERT INTO phpboost_plugin_dragdrop_features (nb_categories , nb_entities) VALUES ('".$nb_categories."' , '".$nb_entities."')",__LINE__,__FILE__);
	$activity_id = $Sql->Query("SELECT MAX(id) FROM ".PREFIX."plugin_dragdrop_features",__LINE__,__FILE__);
}

$tpl = new Template_plugin('course/plugin/drag_and_drop/templates/admin/dragdrop_fillin.tpl');



$tpl->Set_filenames(array(
	'categ_entities' => '/course/plugin/drag_and_drop/templates/admin/dragdrop_fillin.tpl'
));

for($i=0; $i<$nb_categories; $i++)
{
	$tpl->Assign_block_vars('loopCateg', array(
		'ID_CATEGORY' => $i+1
	));
	
	for($j=0; $j<$nb_entities; $j++)
	{
		$tpl->Assign_block_vars('loopCateg.loopEntities', array(
			'ID_ENTITY' => $j+1
		));
	}
}

$tpl->assign_vars(array(
	'TEST_VAR_LANG'=>$LANG['test'],
	'ACTION_FORM'=>$currentLink."insert&activity_id=".$activity_id,
	'NB_CATEGORIES'=>$nb_categories,
	'NB_ENTITIES'=>$nb_entities,
	'CONFIRM'=>$LANG['confirm_message'],
));

$tpl->Pparse('categ_entities');
?>

